<style>
    table.table{border:3px solid #999999; }
    table.table tr{height:30px;padding:0px;}
    .add_box {width: 100%;text-align: center;cursor: pointer;}
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <input type="hidden" name="icons_json" value='{$icons_json}'>
    <!--基本信息-->
    <div class="form-group">
        <table  class="table table-striped table-bordered table-hover dataTable" >
            <tr>
                <th width="140">信息名称：</th>
                <td><input type="text" name="type_name" size="20" /> </td>
            </tr>
            <tr>
                <th width="140">信息模板：</th>
                <td>
                    <textarea cols="50" name="type_tpl"></textarea>
                    <br/>示例:
                    <br/>招聘[1][2],联系电话：[3],地址：[4]
                    <br/>前台显示：
                    <br/>招聘大厨一名，联系电话：133********，地址：********
                </td>
            </tr>
            <tr>
                <th width="140">所属分类</th>
                <td class="radio">
                    <label class="radio-inline">
                        <input type="radio" name="kind" value="information"> 信息类
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="kind" value="mission"> 任务类
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="kind" value="info_mission"> 任务信息类
                    </label>
                </td>
            </tr>
            <tr>
                <th width="140">其他</th>
                <td class="checkbox">
                    <label class="checkbox-inline">
                        <input type="checkbox" name="click_pay" value="1"> 可否设置点击付费
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="see_pay" value="1"> 可否设置付费查看
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="cash_deposit" value="1"> 可否设置保证金
                    </label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="offer_reward" value="1"> 可否设置悬赏
                    </label>
                </td>
            </tr>
        </table>
    </div>
    <!--动态模块-->
    <div class="form-group">
        {volist name="option_list" id="option"}
        <div id="option_{$option['num']-1}" style="height:500px; overflow: hidden;">
            <table  class="table table-striped table-bordered table-hover dataTable" >
                <tr>
                    <th width="140" >编辑信息详情【{$option.num}】<input type="hidden" name="option_id[{$option['num']-1}]" value="{$option.option_id}" /></th>
                    <td align="right" colspan="3"><span  class="icon-remove" title="删除" onclick="del_option({$option['num']-1},{$option.option_id});"></span></td>
                </tr>
                <tr>
                    <th width="140">名称 ：<input type="hidden" name="type_num[{$option['num']-1}]" value="{$option.num}" /></th>
                    <td colspan="3"><input type="text" name="option_name[{$option['num']-1}]" value="{$option['option_name']}" size="20" /></td>

                    <th width="140">选项标记 ：</th>
                    <td colspan="3"><input type="text" name="letter[{$option['num']-1}]" value="{$option['letter']}" size="20" placeholder="英文标记,同类下不可重复"/></td>
                </tr>
                <tr>
                    <th width="140">类型 ：{$option['option_type']}</th>
                    <td colspan="3">
                        <label><input type="radio" name="option_type[{$option['num']-1}]" value="0" />文本框</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="1" />文本域</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="2" />单选</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="3" />多选</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="4" />时间</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="5" />文件上传</label> &nbsp;
                        <label> <input type="radio" name="option_type[{$option['num']-1}]" value="6" />时间范围</label> &nbsp;
                    </td>
                </tr>
                <tr>
                    <th width="140">单选/多选 的选项：</th>
                    <td colspan="3"><textarea name="data_list[{$option['num']-1}]" cols="50">{$option['data_list']}</textarea>
                        （选项之间用“|”分割）</td>
                </tr>
                <!--0:文本框,1:文本域,2:单选,3:多选,4:时间,5:文件上传,6:时间范围-->
                <tr>
                    <th width="140">是否显示名称 ：</th>
                    <td width="220"><label><input type="radio" name="is_show_name[{$option['num']-1}]" <if condition="$option['is_show_name'] eq '0'">checked="checked"</if> value="0"  />不显示</label> &nbsp;<label> <input type="radio" name="is_show_name[{$option['num']-1}]" value="1"  />显示</label> </td>
                    <th width="140">是否必填 ：</th>
                    <td><label><input type="radio" name="is_must[{$option['num']-1}]" value="0" <if condition="$option['is_must'] eq '0'">checked="checked"</if>  />否</label> &nbsp;<label> <input type="radio" name="is_must[{$option['num']-1}]" value="1" <if condition="$option['is_must'] eq '1'">checked="checked"</if>  />是</label> </td>
                </tr>

                <tr>
                    <th width="140">文本框/文本域<br /> 底纹描述文字：</th>
                    <td><input type="text" name="option_holder[{$option['num']-1}]" value="{$option.option_holder}"  /></td>

                    <th width="140">备注 ：</th>
                    <td><input type="text" name="option_notes[{$option['num']-1}]" value="{$option.option_notes}"  /></td>
                </tr>
                <tr>
                    <th width="140">是否允许用户自己填写 ：</th>
                    <td><label><input type="radio" name="is_self[{$option['num']-1}]" value="0" <if condition="$option['is_self'] eq '0'">checked="checked"</if>  />不允许</label> &nbsp;<label> <input type="radio" name="is_self[{$option['num']-1}]" value="1" <if condition="$option['is_self'] eq '1'">checked="checked"</if>  />允许</label> </td>

                    <th width="140">自己填写后置/单位/规格/属性：</th>
                    <td><input type="text" name="self_suffix[{$option['num']-1}]" value="{$option.self_suffix}"  /></td>
                </tr>
                <tr>
                    <th width="140">是否在详情页面显示</th>
                    <td>
                        <label>
                            <input type="radio" name="detail_show[{$option['num']-1}]" value="0" />不显示
                        </label> &nbsp;
                        <label>
                            <input type="radio" name="detail_show[{$option['num']-1}]" value="1" />显示
                        </label>
                    </td>

                    <th width="140">是否关联付费查看</th>
                    <td>
                        <label>
                            <input type="radio" name="pay_connect[{$option['num']-1}]" value="0" {$option['pay_connect']=='0'?'checked':''}/>不关联
                        </label> &nbsp;
                        <label>
                            <input type="radio" name="pay_connect[{$option['num']-1}]" value="1" {$option['pay_connect']=='1'?'checked':''}/>关联
                        </label>
                    </td>
                </tr>
                <tr>
                    <th width="140">显示图标</th>
                    <td colspan="3">
                        {volist name="icons" id="icon"}
                        <div style="display: inline-block">
                            <label class="radio-inline">
                                <img src="{$icon['path']}" alt="{$icon['title']}" style="position: relative;right: 10px;">
                                <br>
                                <input type="radio" name="icon[{$option['num']-1}]" value="{$icon['title']}" {$option['icon']==$icon['title']?'checked':''}/>icon{$icon['title']}
                            </label> &nbsp;
                        </div>
                        {/volist}
                    </td>
                </tr>
            </table>
        </div>
        {/volist}
        <div class="add_box">
            <span class="btn btn-default btn-add add-info">
                <i class="fa fa-plus"></i>
                添加一个新选项
            </span>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled sub">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    function show_sub(obj,op_num){
        var obj_val = obj.attr("value");

        if(obj_val == 2){
            $("#add_sub_"+op_num).show();
        }
        else{
            $("#add_sub_"+op_num).hide();
        }
    }
    function del_option(option_num,option_id){
        _confirm("确定要删除此项吗？删除后，此项的所有数据将全部被清楚。",function(){
            $("#option_"+option_num).animate({
                height: "1px",
            }, 500,function(){
                $("#option_"+option_num).remove();
            });
        })
        if(parseInt(option_id) > 0){
            $("#type_br").before("<input type='hidden' name='del_option[]' value='"+option_id+"' />");
        }
    }
</script>